<?php $this->load->view('sys_header');?>

<script type="text/javascript">


    function ajax_submit(){

        //验证表单
        $.ajax({
            type:"post",
            dataType:'json',
            url:'<?php echo made_admin_url('nav/insert');?>',
            data:$('#cpform').serialize(),
            success:function(r){
                if(r && r.success)
                {
                    $.messager.confirm('成功提示', r.msg , function(b){
                        document.location.href = '<?php echo made_admin_url('nav');?>';
                    });
                }
                else
                {
                    lin.msg(r.msg,'error');
                }
            }
        });

    }







</script>

<div class="nav">
    <h2><a href="<?php echo made_admin_url('main/mainfra');?>">TAYCMS后台管理</a> >  <a href="<?php echo made_admin_url('nav');?>">网站导航配</a> > <a href="<?php echo made_admin_url('ad/addnav');?>">添加</a> </h2>
</div>



<div class="contenter">
    <div class="addpage">
    <h1></h1>
    <div class="ml"></div>

    <div id="editform">

        <form name="cpform" method="post" autocomplete="off"    id="cpform"   >

            <table  width="100%" border="0" align="left" cellpadding="0" cellspacing="0" >
                <TR>
                    <TD width="100%">

                        <table width="95%" border="0" align="center" cellpadding="3" cellspacing="0"  >

                            <tr>
                                <td>父导航：</td>
                                <td><select name="parentid" class="select" style="width: 127px;" >
                                    <option value="-1">请选择父导航</option>
                                    <option value="0">根导航</option>
                                    <?php foreach($info_class as $i): ?>
                                    <option value="<?php echo $i['id']?>" ><?php echo $i['name']?></option>
                                    <?php endforeach; ?>
                                </select></td>
                            </tr>

                            <tr>
                                <td width="12%" height="30">导航名称：</td>
                                <td width="88%"><label>
                                    <input type="text" name="name" id="name" class="border" value="" size="50" />
                                </label></td>
                            </tr>


                            <tr>
                                <td width="12%" height="30">导航描述：</td>
                                <td width="88%"><label>
                                    <input type="text" name="title" id="title" class="border" value="" size="50" />
                                </label></td>
                            </tr>

                            <tr>
                                <td width="12%" height="30">导航链接：</td>
                                <td width="88%"><label>
                                    <input type="text" name="url" id="url" class="border" value="" size="50" />
                                </label></td>
                            </tr>

                            <tr>
                                <td width="12%" height="30">类型：</td>
                                <td width="88%">
                                    <label><input type="radio" name="type" value="1" accept="" checked="checked"> 主导航</label>
                                    <label><input type="radio" name="type" value="2" accept=""> 顶部导航</label>
                                    <label><input type="radio" name="type" value="3" accept=""> 底部导航</label>
                                </td>
                            </tr>




                            <tr>
                                <td width="12%" height="30">是否新窗口打开：</td>
                                <td width="88%">
                                    <label><input type="radio" name="target" value="1" accept="" checked="checked"> 是</label>
                                    <label><input type="radio" name="target" value="0" accept=""> 否</label>
                                </td>
                            </tr>

                            <tr>
                                <td width="12%" height="30">是否可用：</td>
                                <td width="88%">
                                    <label><input type="radio" name="available" value="1" accept="" checked="checked"> 是</label>
                                    <label><input type="radio" name="available" value="0" accept=""> 否</label>
                                </td>
                            </tr>

                            <tr>
                                <td height="30">显示顺序：</td>
                                <td><label>
                                    <input type="text" name="displayorder" id="displayorder" size="10" class="border" value="0" />
                                      </label></td>
                            </tr>


                            <tr>
                                <td height="30">文字颜色：</td>
                                <td><label>

                                    <input type="text" name="highlight" id="highlight"   size="20" class="border" value="" /> <input type="button" class="sub_btn"   id="colorpicker" value="选择颜色" /> 可输入颜色代码如：#B8D100
                                       </label>
                                    <script charset="utf-8" src="<?php echo base_url(); ?>/static/plugins/editor/kindeditor.js"></script>
                                    <link rel="stylesheet" href="<?php echo base_url(); ?>/static/plugins/editor/themes/default/default.css" />
                                    <script type="text/javascript">
                                        KindEditor.ready(function(K) {
                                            var colorpicker;
                                            K('#colorpicker').bind('click', function(e) {
                                                e.stopPropagation();
                                                if (colorpicker) {
                                                    colorpicker.remove();
                                                    colorpicker = null;
                                                    return;
                                                }
                                                var colorpickerPos = K('#colorpicker').pos();
                                                colorpicker = K.colorpicker({
                                                    x : colorpickerPos.x,
                                                    y : colorpickerPos.y + K('#colorpicker').height(),
                                                    z : 19811214,
                                                    selectedColor : 'default',
                                                    noColor : '无颜色',
                                                    click : function(color) {
                                                        K('#highlight').val(color);
                                                        K('#highlight').css('background',color);
                                                        colorpicker.remove();
                                                        colorpicker = null;
                                                    }
                                                });
                                            });

                                        });
                                    </script>


                                </td>
                            </tr>




                        </table>


                    </TD>
                </TR>
                <tr>
                    <td height="30" colspan="2" align="center">
                        <br><br>
                        <label>
                        <input name="submit" type="button" id="submit" value="提交" onclick="ajax_submit()"   class="sub_btn" />
                    </label>
                        <label>
                            <input name="re" type="button" id="re" value="返回" onclick="window.location.href='<?php echo made_admin_url('info');?>'"   class="sub_btn" />
                        </label>
                    </td>
                </tr>
            </table>


        </form>


    </div>

</div>
</div>







<?php $this->load->view('sys_footer');?>